using System;
using System.Collections.Generic;
using System.Text;

namespace Sleddog.BreederDelight.Breeder_Calc
{
	public struct WrightsBase
	{
		private int damDepth;
		private int sireDepth;
		private double ancestorCOI;

		public WrightsBase( int damDepth, int sireDepth ) : this( damDepth, sireDepth, 0 )
		{
		}

		public WrightsBase( int damDepth, int sireDepth, double ancestorCOI )
		{
			this.damDepth = damDepth;
			this.sireDepth = sireDepth;
			this.ancestorCOI = ancestorCOI;
		}

		public double PartialCOI( )
		{
			double partialCOI = 0;

			int power = damDepth + sireDepth + 1;
			double ancestorCorrection = 1 + ( ancestorCOI / 100 );
			double baseCOI = 0.5;

			// 0.5 ^ ( n + n' + 1 ) * ( 1 + F(A) )
			partialCOI = Math.Pow( baseCOI, power ) * ancestorCorrection;

			return partialCOI;
		}
	}
}
